class Solution {
    public int takeAttendance(int[] records) {

        if(records.length==1) return records[0]==0?1:0;

        int left=0,right=records.length-1,mid;
        while(left<right){
            mid=(right-left)/2+left;
            if(records[mid]==mid) left=left+1;
            else right=mid;
        }

        if(right==records[right]) return right+1;

        return right;

    }

    public static void main(String[] args) {
        System.out.println(1);
    }
}